<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .box1 {
      width: 100%;
      height: 100px;
      transition: all .5s;
      margin-top: 10px;
    }

    .box2 {
      background-color: brown;
      transition: all .5s;
    }

    .box3 {
      box-shadow: 10px 10px 10px rgba(0, 0, 0, .5);
      transition: all .5s;
    }

    .box4 {
      display: flex;
      justify-content: center;
      align-items: center;
      color: #ffffff;
      font-size: 20px;
      transition: all .5s;
    }
  </style>
</head>

<body>
  <div id="app">
    <button @click="classArr.push('box1')">添加box1类</button>
    <button @click="classArr.push('box2')">添加box2类</button>
    <button @click="classArr.push('box3')">添加box3类</button>
    <button @click="classArr.push('box4')">添加box4类</button>
    <!--数组语法：把一个数组传给 v-bind:class，以应用一个 class 列表 -->
    <div :class="classArr">动态绑定class对象语法</div>
    <div :class="['box1','box2','box3','box4']">动态绑定class对象语法</div>

  </div>
  <script src="../../javascript//vue.js"></script>
  <script>
    const vm = new Vue({
      el: "#app",
      data() {
        return {
          classArr:[]
        }
      },
    })
  </script>
</body>

</html>